#include"DoubleLinkList.h"
#include<iostream>
#include<ctime>
#include<cstring>
class Student
{
public:                                                                                                                
        
    
        Student(int id,const char *name)
        {            
            this->id=id;
            this->name=name;
        }
     
        friend void PrintStu(void *p);
        friend bool IsidEqual(void *p1,void *p2);
        friend bool IsidBig(void *p1,void *p2);
private:
    int id;
    std::string name;
};
void ClearStu(void *p)
{
    Student*s=(Student*)p;
    delete s;
 
}

void PrintStu(void *p)
{
  Student*s=(Student*)p;
 std::cout<<"学生姓名:"<<s->name<<"学生学号:"<<s->id<<std::endl; 

}
bool IsidEqual(void *p1,void *p2)
{
    Student *s1=(Student*)p1;
    Student *s2=(Student*)p2;
    return s1->id==s2->id;   
}
bool IsidBig(void *p1,void *p2)
{
    Student *s1=(Student*)p1;
    Student *s2=(Student*)p2;
    return s1->id>s2->id;   
}


int main()
{
    DoubleLinkList list;
    Student *s=new Student(3,"zhangsan");
    Student *s1=new Student(1,"lisi");
    Student *s2=new Student(2,"wangwwu");

    list.setfunc(ClearStu,IsidEqual,IsidBig,PrintStu);
    list.InsertTail(s);
    list.InsertTail(s1);
    list.InsertTail(s2);
    list.Sort();
    list.show();
  
  
 
//    list.RemoveByelement(2);
//    list.show();
  
 
    // list.InsertByIndex(0,99);
    // list.InsertByIndex(10,99);
    // list.show();
    // DoubleLinkList list1(list);
    // list1.show();



    // list.InsertByindex(1,99);
    // list.RemoveByindex(0);
    
// DArray::DynamicArray a=list.FindElement(7);
// a.setfunc(nullptr,nullptr,nullptr,Print);
// a.show();
    // list.UpdateByindex(0,1009);
    // list.UpdateByElement(8,888);
    // list.Sort();
    // list.show();


    return 0;




}